import 'package:equatable/equatable.dart';
import 'package:backend.purchases/domain/entities/app_store_api/app_store_api_environment.dart';
import 'package:backend.purchases/domain/entities/app_store_api/app_store_api_transaction_offer_type.dart';
import 'package:backend.purchases/domain/entities/app_store_api/app_store_api_transaction_ownership_type.dart';
import 'package:backend.purchases/domain/entities/app_store_api/app_store_api_transaction_revocation_info.dart';
import 'package:backend.purchases/domain/entities/app_store_api/app_store_api_transaction.dart';

class AppStoreApiSubscriptionTransaction extends Equatable implements AppStoreApiTransaction {
  const AppStoreApiSubscriptionTransaction({
    required this.id,
    required this.time,
    required this.originalTransactionId,
    required this.purchaseItemSku,
    required this.offerType,
    required this.ownershipType,
    required this.environment,
    required this.revocationInfo,
    required this.expirationTime,
  });

  @override
  final String id;

  @override
  final DateTime time;

  @override
  final String originalTransactionId;

  @override
  final String purchaseItemSku;

  @override
  final AppStoreApiTransactionOfferType offerType;

  @override
  final AppStoreApiTransactionOwnershipType ownershipType;

  @override
  final AppStoreApiEnvironment environment;

  @override
  final AppStoreApiTransactionRevocationInfo? revocationInfo;

  final DateTime expirationTime;

  @override
  List<Object?> get props {
    return [
      id,
      time,
      originalTransactionId,
      purchaseItemSku,
      offerType,
      ownershipType,
      environment,
      revocationInfo,
      expirationTime,
    ];
  }
}
